@include('admin.header')

<style type="text/css">
  .opartion {
    width: 5%;
  }

  .pagination {
    list-style: none;
    float: right;
  }

  .pagination li {
    float: left;
    padding-left: 5px;
    padding-right: 5px;
  }

  .input_search {
    margin-top: 10px;
  }
</style>

<div class="wrap">
  <div class="margin-bottom-20">
    <!-- <a class="btn btn-primary edit"><i class="fa fa-plus"></i> 添加</a> -->
    {{ csrf_field() }}
    <input id="change_url" value="" type="hidden"/>
    <form action="{{url('order/purchas_list')}}" method="post">
        <div class="cl pd-5 bg-1 bk-gray mt-20">
            <span class="text-c">
            <input type="text" name="order_no" placeholder="订单编号" style="width:250px" class="input-text input_search" value="{{$order_no}}">
            <button name="" id="search" class="btn btn-success user_search" type="
            submit"><i class="Hui-iconfont"></i> 搜索</button>
            </span>
            <span class="r">共有数据：<strong>{{$data->total()}}</strong> 条</span>
        </div>
    </form>
  </div>
  <form class="form-horizontal js-ajax-form" method="post" novalidate="novalidate">
    <table class="table table-hover table-bordered">
      <thead>
      <tr>
        <th width="100">订单ID号</th>
        <th>订单编号</th>
        <th>商品名称</th>
        <th>商品价格</th>
        <th>是否支付成功</th>
        <th>用户手机号</th>
        <th>用户推荐人</th>
        <th>支付时间</th>
        <th class="opartion">操作</th>
      </tr>
      </thead>
      <tbody>

      @foreach($data as $order)
      <tr>
        <td>{{$order->order_id}}</td>
        <td>{{$order->order_no}}</td>
        <td>{{$order->product_name or ''}}</td>
        <td>{{$order->product_price or ''}}</td>
        <td>
          @if($order->status == 1)
            是
          @else
            否
          @endif
        </td>
        <td>{{$order->nodename}}</td>

        <td>{{$order->introducer}}</td>
        <td>{{$order->pay_time}}</td>
        <td>
          <a class="order_detail" _id="{{$order->order_id}}" nodename="{{$order->nodename}}" introducer="{{$order->introducer}}"
          order_no="{{$order->order_no}}">详情</a>
        </td>
      </tr>
      @endforeach
      </tbody>
    </table>

    <!-- 分页 -->
    @if (!empty($data))
      <div class="page_list">
        {{$data->links()}}
      </div>
    @endif

  </form>
</div>

<script>

  $(function(){
    //订单详情
  	$('.order_detail').click(function(){
      //获取参数
  	  var id         = $(this).attr('_id') || 0;
      var nodename   = $(this).attr('nodename');
      var introducer = $(this).attr('introducer');
      var order_no   = $(this).attr('order_no');
      open_iframe_layer('/order/order_detail?id='+id+'&nodename='+nodename+'&introducer='+introducer+'&order_no='+order_no);
    });
  });
</script>